<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="app">
        <h1>您的成绩评价</h1>
        <b><component1 :score="50"></component1></b>
        <b><component1 :score="65"></component1></b>
        <b><component1 :score="90"></component1></b>
        <b><component1 :score="100"></component1></b>
    </div>
    <script>
        Vue.component('component1',{
            props:['score'],
            template:`
            <div>
                {{score}}分，{{testResult}}
            </div>
            `,
            computed:{
                testResult:function(){
                    var strResult = '';
                    if(this.score<=50)
                    strResult="不及格";
                    else if(this.score<90)
                    strResult="中等生";
                    else if(this.score>=90)
                    strResult="优秀生";
                    return strResult
                }
            }
        })
        var vm = new Vue({
            el: '#app',
            data: {},
            methods: {}
        })
    </script>
</body>

</html>